import { Component } from '@angular/core';
import { BarCodeSannerPage } from './barcodescanner/barcodescanner';
import { FormPage } from './form/form';
import { ListPage } from './list/list';
import { AddressListPage } from './addresslist/addresslist';

import { NavController } from 'ionic-angular';
import { Camera } from '@ionic-native/camera';
import { MapPage } from '../mappage/mappage';
import { SelectImage } from '../selectimage/selectimage';
import { ButtonSelf } from '../button/buttonself';
import{ DataTime } from '../datatime/datatime'
@Component({
  selector: 'page-case',
  templateUrl: 'case.html'
})
export class CasePage {
  items1: Array<{ title: string, text: string, icon: string, bgcolor: string }>;
  items2: Array<{ title: string, text: string, icon: string, bgcolor: string }>;
  constructor(public navCtrl: NavController, public Camera: Camera) {
    this.items1 = [
      { title: 'ListPage', text: '列表', icon: 'sl3', bgcolor: 'bgcblue1' },
      { title: 'FormPage', text: '表单', icon: 'sl5', bgcolor: 'bgcyellow' },
      { title: 'ButtonSelf', text: '按钮', icon: 'sl2', bgcolor: 'bgccyan' },
      { title:'datatime', text:'时间选择器',icon:'pay1',bgcolor:'bgccyan'}];
    this.items2 = [
      { title: 'SelectImage', text: '选择图片', icon: '', bgcolor: 'bgcblue1' },
      { title: 'BarCodeSannerPage', text: '扫描条形码', icon: '4', bgcolor: 'bgcpurple' },
      { title: 'MapPage', text: '我的位置', icon: '6', bgcolor: 'bgcblue1' },
      { title: 'AddressListPage', text: '通讯录', icon: '3', bgcolor: 'bgcblue1' }];
    }
  
  itemTapped(event, item) {
    switch (item.title) {
      case 'BarCodeSannerPage':
        this.navCtrl.push(BarCodeSannerPage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      case 'ButtonSelf':
        this.navCtrl.push(ButtonSelf, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
         case 'datatime':
        this.navCtrl.push(DataTime, {
          item: item
        },{animate: true,direction:'forward'});
        break;
      case 'SelectImage':
        this.navCtrl.push(SelectImage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      case 'MapPage':
        this.navCtrl.push(MapPage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      case 'ListPage':
        this.navCtrl.push(ListPage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      case 'FormPage':
        this.navCtrl.push(FormPage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      case 'AddressListPage':
        this.navCtrl.push(AddressListPage, {
          item: item
        }, { animate: true, direction: 'forward' });
        break;
      default:
        break;
    }
  }
}
